<?php

use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel frontend\models\CompanySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Companies';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="company-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php //echo $this->render('_search', ['model' => $searchModel]); ?>

    <?php $form = ActiveForm::begin(['method' => 'get', 'action' => ['index']]) ?>

    <?= $form->field($searchModel, 'global_search') ?>
    <button type="submit" class="btn btn-primary">Search</button>

    <?php ActiveForm::end() ?>
    <hr>

    <p><?= Html::a('Create Company', ['create'], ['class' => 'btn btn-success']) ?></p>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            //'id',
            'name',
            'email:email',
            'address',
            'started_at',
//            [
//                'attribute' => 'started_at',
//                'value' => 'started_at',
//                'filter' => DatePicker::widget([
//                    'model' => $searchModel,
//                    'attribute' => 'started_at',
//                    'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']
//                ])
//            ],
            //'created_at',
            //'status',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>

</div>
